Ccay.Module.define("Ccay.example.ui.tree",function(page,$S){
	var newCount = 1;
	page.ready=function(){
		//整个页面的初始化
		$S("#treeTab").ccayTab({itemMaxCount:15});
		//普通单选树初始化。
		initRegistryTree();
		//radio单选树初始化。
		initSiteMapRadioTree();
		//复选树初始化。
		initSiteMapCheckboxTree();
		//初始化可选择图标的树
		initCssIconSiteMapTree();
		initIconSiteMapTree();
		initTreeWithRmenu();
		initClick2CheckTree();
		initCollapseTree();
		initTreeLadyLoad();
	};
	/**普通树延迟加载*/
	function initTreeLadyLoad(){
		var setting={
				keepParent:true,
				simpleData:{
					idKey:"siteNodeId", /**节点数据中保存唯一标识的属性名称*/
					rootPId:"0" /**根节点父节点id，即根节点 pIdKey 指定的属性值*/
				},
				onExpand : function(event, treeId, treeNode) {
					if (treeNode._loaded)
						return;
					treeNode._loaded = true;//标识是否加载
					var treeObj = $.fn.zTree.getZTreeObj(treeId);
					treeObj.removeChildNodes(treeNode);
					Ccay.doGet("services/manage/sitemap/tree/list?parentId={0}".formatURI(treeNode.siteNodeId),"",function(datas){
						$.each(datas||[],function(i,d){
							d.hasChild && (d.isParent = true);
							d.name = Ccay.DataHelper.languageExtraction(d.name+"");
						});
						treeObj.addNodes(treeNode, datas||[]);
					});
				}
			};    
		Ccay.doGet("services/manage/sitemap/tree/list",null,function(datas){
			datas = datas.splice(0,1);
			$.each(datas,function(i,d){
				d.name = Ccay.DataHelper.languageExtraction(d.name+"");
			});
			$S('#tree_lazyload').ccayTree(datas,setting,function(data){});
		});
	}
	
	/**普通单选树实现*/
	function initRegistryTree(fn){
		var  setting={
			expandLevel: "0", /**设置展现的层级*/
			filter: true, /**设置搜索框*/
			showRemoveBtn:true,/**设置是否显示删除按钮*/
			onClick:onTreeClick, /**设置点击节点触发函数*/
			onRemove: onRemoveRegistryNode, /**设置点击删除节点按钮触发函数*/
			simpleData:{
				idKey:"propertyId", /**节点数据中保存唯一标识的属性名称*/
				pIdKey:"parentId", /**节点数据中保存其父节点唯一标识的属性名称*/
				rootPId:"0" /**根节点父节点id，即根节点 pIdKey 指定的属性值*/
			}
		};    
    	 $S('#registryTree').ccayTree("services/manage/registry/list",setting,function(data){
	     	var tree=$S('#registryTree').getCcayTreeManager();	   
	        var node=tree.getNodeByParam("propertyId",0);	        
	        tree.expandNode(node,true);
	     	fn && fn();
    	 });	

	}
	
	/**右键 直接添加，编辑，拖拽菜单树*/
	function initTreeWithRmenu(fn){
		var  setting={
			expandLevel: "0", /**设置展现的层级*/
			filter: true, /**设置搜索框*/
			showRenameBtn:true,//设置是否显示重命名按钮,看设置Ccay.Permission.check('xxx:xxx')绑定权限
			addHoverDom: addNodeBtn, //添加添加节点按钮 与removeHoverDom配合使用
			removeHoverDom: removeHoverDom,//添加节点的移除
			showRemoveBtn:true,// 设置是否显示删除按钮  与onRemove配合使用
			onRemove: removeTreeNode, /**设置点击删除节点按钮触发函数*/
			onRename: function(treeId, oldName, treeNode){
					if(treeNode.name == oldName){
						return;
					}
					Ccay.Common.save(false,"services/ccay/demo/tree/edit",treeNode,function(){				
						Ccay.UI.topBox("重命名成功");
					})		
			},
			onDrop: function(event, treeId, treeNode){
			    	if(treeNode){
						Ccay.Common.save(false,"services/ccay/demo/tree/edit",treeNode[0],function(){				
						});
			    	}
			},
			simpleData:{
				idKey:"id", /**节点数据中保存唯一标识的属性名称*/
				pIdKey:"parentId", /**节点数据中保存其父节点唯一标识的属性名称*/
				rootPId:"0" /**根节点父节点id，即根节点 pIdKey 指定的属性值*/
			}
		};    
    	$S('#treewithmenu').ccayTree("services/ccay/demo/tree/list",setting,function(data){
		     	var tree=$S('#treewithmenu').getCcayTreeManager();	   
		        var node=tree.getNodeByParam("id",0);	        
		        tree.expandNode(node,true);
		     	fn && fn();
    	});	

	}
		
	function addNodeBtn(treeId, treeNode) {
			var sObj = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#addBtn_"+treeNode.id).length>0) return;
			var addStr = "<button type='button' class='add' id='addBtn_" + treeNode.id
				+ "' title='add node' onfocus='this.blur();'></button>";
			var editStr = "<a class=\"ccay-icon edit\" title=\"update node\" id='editBtn_" + treeNode.id
			    + "' style=\"width:16px;margin-top:-2px;margin-right:0px;\"></a>";
			sObj.append(addStr).append(editStr);
			
			var btn = $("#addBtn_"+treeNode.id);
			if (btn) btn.bind("click", function(){
				var zTree = $S('#treewithmenu').getCcayTreeManager();	
				var nodeName = "new node"+(newCount++);
				zTree.addNodes(treeNode, {parentId:treeNode.id, name:nodeName});
				Ccay.Common.save(true,"services/ccay/demo/tree/create",{parentId:treeNode.id, name:nodeName},function(){	
						initTreeWithRmenu(function(){
							var treeObject=$S('#treewithmenu').getCcayTreeManager();
							var node=treeObject.getNodeByParam("id",treeNode.id);				
							treeObject.selectNode(node);
							treeObject.expandNode(node,true);
						});	
				})	
				return false;
			});
			var editbtn = $("#editBtn_"+treeNode.id);
			if (editbtn) editbtn.bind("click", function(){
				var zTree = $S('#treewithmenu').getCcayTreeManager();	
				Ccay.Page.register("Ccay.example.tree.edit","ccay/example/ui/tree/editTree.html");
				Ccay.Common.openPage("编辑",
                         "Ccay.example.tree.edit",
                        { width:500,
                          height:180, buttons:[{text:"ccay.common.button.save",onClick:function(){
		                          Ccay.Common.formSave('#treeForm',"services/ccay/demo/tree/edit",false,function(){		
		                          	    Ccay.example.tree.edit.closeDialog();
		                          	    initTreeWithRmenu(function(){
											var treeObject=$S('#treewithmenu').getCcayTreeManager();
											var node=treeObject.getNodeByParam("id",treeNode.id);				
											treeObject.selectNode(node);
											treeObject.expandNode(node,true);
										});	
								  })
                          }},
				                               {text:"ccay.common.button.cancel",onClick:function(){Ccay.example.tree.edit.closeDialog()}}]
				        },         
				         function(){
				          var pName;
				          treeNode.getParentNode() ? pName = treeNode.getParentNode().name : pName = "root"
				          $S("#treeForm").jsonData(treeNode);
				          $S("#treeForm").nameChild("parentName").val(pName);
				});
				return false;
			});
	};
		
	function removeHoverDom(treeId, treeNode) {
			$("#addBtn_"+treeNode.id).unbind().remove();
			$("#editBtn_"+treeNode.id).unbind().remove();
	};	
	
	function removeTreeNode(treeId, treeNode){
		if(treeNode.isParent) {
			Ccay.UI.showMessage("ccay.security.message.canNotDelete","warn");
			return false;
		}else{
			Ccay.UI.confirm("ccay.security.message.confirmDelete",function(bool){
				if(bool){
					//执行后台删除
					Ccay.UI.topBox("ccay.common.message.deleteSuccess");
					var treeObject=$S('#treewithmenu').getCcayTreeManager();
					treeObject.removeNode(treeNode);
				}
			});
		}
	};

/*	function onTreeClickWithRmenu(event, treeId, treeNode) {
		$S("#selectParent").show();
		var treeObject=$S('#treewithmenu').getCcayTreeManager();		
		*//**得到父节点的数据*//*
		var parentNode = treeObject.getNodeByParam("id",treeNode.parentId);
		var form = $S("#registryFormwithRmenu");
		*//**如果有子节点，则不能修改父节点，隐藏按钮*//*
		if( treeNode.isParent ){
			*//**选择父节点按钮不可用*//*
			$S("#selectParent").hide();
		}
		*//**form显示数据*//*
		form.jsonData(treeNode);
		*//** parentPath 处理*//*
		if(treeNode.parentId==0){
			form.nameChild("parentName").val("root");
	   	}else{
	   		form.nameChild("parentName").val(parentNode.name);
	   	}
		form.nameChild("parentId").val(treeNode.parentId);
		form.valid();
		return false;
	}*/
	
	/** 单击树时，form显示数据，数据可修改（更新）*/
	function onTreeClick(event, treeId, treeNode) {
		$S("#selectParent").show();
		var treeObject=$S('#registryTree').getCcayTreeManager();		
		/**得到父节点的数据*/
		var parentNode = treeObject.getNodeByParam("propertyId",treeNode.parentId);
		var form = $S("#registryForm");
		/**name不可修改*/
		form.nameChild("name").attr("readOnly",true);
		/**如果有子节点，则不能修改父节点，隐藏按钮*/
		if( treeNode.isParent ){
			/**选择父节点按钮不可用*/
			$S("#selectParent").hide();
		}
		/**form显示数据*/
		form.jsonData(treeNode);
		/** parentPath 处理*/
		if(treeNode.parentId==0){
			form.nameChild("parentName").val("root");
	   	}else{
	   		form.nameChild("parentName").val(parentNode.name);
	   	}
		form.nameChild("parentId").val(treeNode.parentId);
		form.valid();
		return false;
	}
	 
	/**创建一颗栏目树*/
	page.selectParent = function() {
		var  setting={simpleData:{idKey:"propertyId",pIdKey:"parentId",rootPId:"0"},expandLevel:1}; 
	    Ccay.doGet("services/manage/registry/list","",function(data){	 
	     	data.push({propertyId:0,parentId:-1,name:'root',value:'root', parentPath:'root'}); 
		  	Ccay.Component.popupTree("ccay.sitemap.selectparent",data,setting,function(nodes){
				if(nodes.length>0){
					treeNode=nodes[0];
					if(treeNode.parentPath == "root"){
						path = treeNode.name;
					}else{
						var path = ( treeNode.parentPath+ "."+ treeNode.name);
						path = path.substring(path.indexOf('root.'),path.length);
					}
					/**更新时父节点不能选择自己本身*/
					if(form.nameChild("propertyId").val() !='' && form.nameChild("propertyId").val() == treeNode.propertyId){
						Ccay.UI.showMessage("ccay.registry.message.chooseParentNodeErr","warn");
						return false;
					}else{
						form.nameChild("parentName").val(treeNode.name);
						form.nameChild("parentId").val(treeNode.propertyId);
						form.nameChild("parentPath").val(path);
					}
				}
			});
		 })
	};

	page.selectParent1 = function() {
		 
		var form = $S("#treeForm");
		var  setting={simpleData:{idKey:"id",pIdKey:"parentId",rootPId:"0"},expandLevel:1,selectField:"id", chkDisableds:[form.nameChild("id").val()]};
	    Ccay.doGet("services/ccay/demo/tree/list","",function(data){	 
	     	data.push({id:0,parentId:-1,name:'root',value:'root'}); 
		  	Ccay.Component.popupTree("ccay.sitemap.selectparent",data,setting,function(nodes){
				if(nodes.length>0){
					treeNode=nodes[0];
					if(treeNode.parentPath == "root"){
						path = treeNode.name;
					}else{
						var path = ( treeNode.parentPath+ "."+ treeNode.name);
						path = path.substring(path.indexOf('root.'),path.length);
					}
					/**更新时父节点不能选择自己本身*/
					if(form.nameChild("id").val() !='' && form.nameChild("id").val() == treeNode.id){
						Ccay.UI.showMessage("ccay.registry.message.chooseParentNodeErr","warn");
						return false;
					}else{
						form.nameChild("parentName").val(treeNode.name);
						form.nameChild("parentId").val(treeNode.id);
					}
				}
			});
		 })
	};

	/** 保存编辑信息*/
	page.save=function (){
		if(!form.valid())return;
		var registryNode=form.jsonData();	
		/**若不选父节点,则其parentPath为"root"*/
		if(registryNode.parentPath == null){
			registryNode.parentPath="root";	
		}	
		var isCreate=false;	
		/**判断propertyId是否空，为空则添加，否则更新*/
		if(Ccay.DataHelper.isEmpty($("input[name=propertyId]").val())){
			isCreate=true;
		}
		Ccay.Common.save(isCreate,"services/ccay/registry/single",registryNode,function(){				
			if(isCreate){
				/**清空form*/
				form.ccayReset();				
			};
			/**初始化tree 并在此级节点展开*/
			initRegistryTree(function(){
				var treeObject=$S('#registryTree').getCcayTreeManager();
				var node=treeObject.getNodeByParam("propertyId",isCreate?registryNode.parentId:registryNode.propertyId);				
				treeObject.selectNode(node);
				treeObject.expandNode(node,true);
			});				
			/**操作提示*/
			Ccay.UI.topBox(isCreate?"ccay.security.message.dictionaryAddSuccess":"ccay.security.label.dictionaryUpdateSuccess");
		})		
	};
	
		/** 保存编辑信息*/
/*	page.saveByRmenu=function (){
		var form = $S("#registryFormwithRmenu");
		if(!form.valid())return;
		var registryNode=form.jsonData();	
		
		var isCreate=false;	
		*//**判断id是否空，为空则添加，否则更新*//*
		if(Ccay.DataHelper.isEmpty($("input[name=id]").val())){
			isCreate=true;
		}
		Ccay.Common.save(isCreate,"services/ccay/demo/tree/edit",registryNode,function(){				
			if(isCreate){
				*//**清空form*//*
				form.ccayReset();				
			};
			*//**初始化tree 并在此级节点展开*//*
			initTreeWithRmenu(function(){
				var treeObject=$S('#treewithmenu').getCcayTreeManager();
				var node=treeObject.getNodeByParam("id",isCreate?registryNode.parentId:registryNode.id);				
				treeObject.selectNode(node);
				treeObject.expandNode(node,true);
			});				
			*//**操作提示*//*
			Ccay.UI.topBox(isCreate?"ccay.security.message.dictionaryAddSuccess":"ccay.security.label.dictionaryUpdateSuccess");
		})		
	};*/
	
	/**选择节点后在该节点上添加数据（复位）,点击的节点为新添加的节点的父节点*/
	page.addItem = function() {
			var registryNode=form.jsonData();
			var path = registryNode.parentPath +'.'+ registryNode.name;
			
			if(registryNode.parentPath == "root"){
				path = registryNode.name
			}else{
				path = path.substring(path.indexOf('root.'),path.length);
			}			
	        if(registryNode.propertyId != null){
	        	form.nameChild("parentName").val(registryNode.name);
	    		form.nameChild("parentId").val(registryNode.propertyId);
	    		form.nameChild("parentPath").val(path);
	        }
		    form.nameChild("propertyId").val("");
		    form.nameChild("name").val("");
			/** name 不可写*/
			form.nameChild("name").attr("readOnly",false);	
			$S("#selectParent").show();
	};
	/*page.addItemWithRmenu = function() {
			$S("#registryFormwithRmenu").ccayReset();
	};*/

	/**删除节点 */
	function onRemoveRegistryNode(treeId, treeNode){
		if(treeNode.isParent) {
			Ccay.UI.showMessage("ccay.security.message.canNotDelete","warn");
			return false;
		}else{
			Ccay.UI.confirm("ccay.security.message.confirmDelete",function(bool){
				if(bool){
					//执行后台删除
					Ccay.UI.topBox("ccay.common.message.deleteSuccess");
					var treeObject=$S('#registryTree').getCcayTreeManager();
					treeObject.removeNode(treeNode);
				}
			});
		}
	};
	
	page.exit=function(){
		form=null;
	}
	
	/**radio单选树实现*/
	function initSiteMapRadioTree(fn){
		var  setting={
		    checkType:"single", /**设置radio按钮*/
			expandLevel:"0", /**设置树形展开的层级*/
			filter:true /**设置顶端的搜索框*/
	     };  
		$S('#radioSingleTree').ccayTree("services/manage/registry/list",setting,fn);
	}
	
	/**
	 * 获取选中的树节点
	 * @param treeContainer: tree的jQyery dom容器
	 * @returns 返回树选中的树节点的数组
	 */
	page.getSelectedNodes = function(treeContainer){
		var tree = treeContainer.getCcayTreeManager();
		if (!tree.getCheckedNodes()) {
			alert("您没有选中任何树节点！");
			return [];
		}
		var nodes = tree.getCheckedNodes();
		alert("您选中了" + nodes.length + "个树节点，节点数据为：" + JSON.stringify(nodes));
		var ids=[],names=[];
		$.each(nodes,function(){
			ids.push(this.siteNodeId);
			names.push(this.name);
		});
		alert("节点id数据为："+ids+"；"+ "节点name数据为："+names);
		return nodes;
	};
	
	/**checkbox多选树数实现*/
	function initSiteMapCheckboxTree(fn){
		var setting = {
				expandLevel:"0", /**设置树形展开的层级*/
				filter: true, /**设置顶端的搜索框*/
                checkType:"checkbox", /**设置checkbox按钮*/
                key: {
					check:"checked", /**节点数据中保存check状态的属性名称，此处指定为checked*/
					name: "name", /**节点数据中保存节点名称的属性名称，此处指定为name*/
					children: "children", /**节点数据中保存子节点数据的属性名称，此处指定children*/
					title: "name" /**节点数据中保存提示信息的属性名称，此处指定为name*/
                }
		};
		setting.checkboxType = {"Y":"ps","N":"ps"}; /**设置父子之间联动*/
		$S('#multiTree').ccayTree("services/manage/registry/list",setting,fn);		
	}
	/**初始化CSS设定图标的树*/
	function initCssIconSiteMapTree(fn){
		var cssIconTreeData = function(){
			var data=[
			          	{name: '节点1',iconSkin:"diy01",children:[
		                    { name: '节点1.1',iconSkin:"diy01" },
		                    { name: '节点1.2',iconSkin:"diy01" },
		                    { name: '节点1.3',iconSkin:"diy01", children: [
			                         { name: '节点1.3.1',iconSkin:"diy01" },
			                         { name: '节点1.3.2' ,iconSkin:"diy01"}
		                         ]
		                    },
	                    	{ name: '节点1.4',iconSkin:"diy01" }
		                    ]
			          	},
		                { name: '节点2' ,iconSkin:"diy01"},
		                { name: '节点3',iconSkin:"diy01" },
		                { name: '节点4' ,iconSkin:"diy01"}
	                ];
			return data;
		};
		$S('#cssIconTree').ccayTree(cssIconTreeData());	
	}
	/**初始化数据设定图标的树*/
	function initIconSiteMapTree(fn){
		var iconTreeData = function(){
			/**设置树节点展开时的图标*/
			var iconOpen="ccay/web/resource/skins/default/plugins/ztree/img/diy/3.png";
			/**设置树节点收起时的图标*/
			var iconClose="ccay/web/resource/skins/default/plugins/ztree/img/diy/7.png";
			/**设置树叶子节点的图标*/
			var icon="ccay/web/resource/skins/default/plugins/ztree/img/diy/5.png";
			var data = [];
			data.push({ id: 1, pid: 0, name: '1' , iconOpen:iconOpen, iconClose:iconClose});
			data.push({ id: 2, pid: 1, name: '1.1' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 4, pid: 2, name: '1.1.2' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 5, pid: 2, name: '1.1.2' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});      
	 
			data.push({ id: 10, pid: 8, name: 'wefwfwfe' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 11, pid: 8, name: 'wgegwgwg' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 12, pid: 8, name: 'gwegwg' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
	 
			data.push({ id: 6, pid: 2, name: '1.1.3',iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 7, pid: 2, name: '1.1.4' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 8, pid: 7, name: '1.1.5' ,iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			data.push({ id: 9, pid: 7, name: '1.1.6',iconOpen:iconOpen, iconClose:iconClose,icon:icon});
			return data;
		};
		$S('#iconTree').ccayTree(iconTreeData(), {simpleData:{idKey:"id",pIdKey:"pid",rootPId:0}});	
	}
	
	/**单选弹出树*/
	page.popupSingleTree = function(){
		var  setting={
			expandLevel:1, /**默认展开1级节点*/
			checkType:"single",
			simpleData:{
				idKey:"productCategoryID",
				pIdKey:"productCategoryParentID",
				rootPId:"0"
			}	
		};  
	  	Ccay.Component.popupTree("ccay.sitemap.selectparent","services/manage/registry/list",setting,function(nodes){
			if(nodes.length>0){
				$("#id11").val(nodes[0].registryItemName);
				$("#name11").val(nodes[0].name);
			}
		});
	};
	
	/**多选弹出树*/
	page.popupMultiTree = function(){
		var  setting={
			expandLevel:1, /**默认展开1级节点*/
			checkType:"checkbox",
			checkboxType: {"Y":"ps","N":"ps"}, /**设置父子之间联动*/
			selectField:"propertyId",
			selectItems:$("#id21").val().split(","),
			simpleData:{
				idKey:"propertyId",
				pIdKey:"parentId",
				rootPId:"0"
			}	
		};  
	  	Ccay.Component.popupTree("ccay.sitemap.selectparent","services/manage/registry/list",setting,function(nodes){
	  		var ids=[],names=[];
			$.each(nodes,function(){
				ids.push(this.registryItemName);
				names.push(this.name);
			});
			$("#id21").val(ids.join(","));
			$("#name21").val(names.join(","));
		});
	};
	
	function initClick2CheckTree(){
			var  setting={
				click2Check:true,
			    checkType:"single", /**设置radio按钮*/
				expandLevel:"0", /**设置树形展开的层级*/
				filter:true /**设置顶端的搜索框*/
		     };  
			$S('#click2checkTree_single').ccayTree("services/manage/registry/list",setting);

			var setting = {
				click2Check:true,
				expandLevel:"0", /**设置树形展开的层级*/
				filter: true, /**设置顶端的搜索框*/
                checkType:"checkbox", /**设置checkbox按钮*/
                key: {
					check:"checked", /**节点数据中保存check状态的属性名称，此处指定为checked*/
					name: "name", /**节点数据中保存节点名称的属性名称，此处指定为name*/
					children: "children", /**节点数据中保存子节点数据的属性名称，此处指定children*/
					title: "name" /**节点数据中保存提示信息的属性名称，此处指定为name*/
                }
			};
			setting.checkboxType = {"Y":"","N":""}; /**设置父子之间联动*/
			$S('#click2checkTree_multi').ccayTree("services/manage/registry/list",setting);		
	};
	
	function initCollapseTree(){
	
			var  setting={
				click2Check:true,
			    checkType:"checkbox", /**设置radio按钮*/
				expandLevel:"0", /**设置树形展开的层级*/
				filter:true, /**设置顶端的搜索框*/
				beforeCollapse:function(treeId, treeNode){
					alert("你即将要收起的节点是———— "+treeNode.name+"  , 若你在此方法里返回false的话，可阻止改节点收起。");
					if(treeNode.name == "框架内部测试"){
						alert("因为设置了当收起这个节点时————框架内部测试，返回了false，所以这个节点收不起来哈");
						return false;
					}
				},
				onCollapse:function(event, treeId, treeNode){
					alert("你收起的节点是———— "+treeNode.name)
				},
				beforeExpand:function(treeId, treeNode){
					alert("你即将要展开的节点是———— "+treeNode.name+"  , 若你在此方法里返回false的话，可阻止改节点展开。");
					if(treeNode.name == "框架内部测试"){
						alert("因为设置了当展开这个节点时————框架内部测试，返回了false，所以这个节点收不起来哈");
						return false;
					}
				},
				onExpand:function(event, treeId, treeNode){
					alert("你展开的节点是———— "+treeNode.name)
				}
		     };  
			$S('#tree_collapse').ccayTree("services/manage/registry/list",setting);
	}

});